import math


class Node:  # Node类，记录节点信息，记录坐标、f、g、h以及父节点信息，并定义一些函数
    def __init__(self, point, g=0, h=0):
        self.point = point
        self.ancient = None
        self.g = g
        self.h = h
        self.f = self.g * 0.4 + self.h * 0.6
        self.step = 0

    def getManhattendis(self, endNode):  # 曼哈顿距离，并加权
        self.h = math.sqrt(pow(endNode.point.x - self.point.x, 2) + pow(endNode.point.y - self.point.y, 2) + pow(
            endNode.point.z - self.point.z, 2))

    def getGvalue(self, g):  # 获得当前cost g
        self.g = g

    def ancientNode(self, node):  # 获得父亲节点
        self.ancient = node

    def getStep(self):
        self.step = 0
